package com.scau.service.impl;

import java.sql.Timestamp;
import java.util.Date;
import java.util.List;

import com.scau.dao.ISerCateDao;
import com.scau.service.ISerCateService;
import com.scau.util.DateTransform;
import com.scau.vo.ServiceCategory;

/**
 * @author Jinglun
 * @create 2017年3月14日
 */
public class SerCateServiceImpl implements ISerCateService {
	
	private ISerCateDao serCateDao;
	// 增
	@Override
	public boolean saveSerCate(ServiceCategory serviceCategory) {
		// 设置服务类型创建时间
		// 当前时间由Date->Timestamp
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp ts = dt.dToTimestamp(date);
		serviceCategory.setGmtCreate(ts);
		
		return serCateDao.saveSerCate(serviceCategory);
	}
	// 查
	@Override
	public List<ServiceCategory> listSerCate() {
		return serCateDao.listSerCate();
	}
	// 改
	@Override
	public boolean updateSerCate(ServiceCategory serviceCategory) {
		// 设置服务类型修改时间
		// 当前时间由Date->Timestamp
		Date date = new Date();
		DateTransform dt = new DateTransform();
		Timestamp modif = dt.dToTimestamp(date);
		serviceCategory.setGmtModified(modif);
		return serCateDao.updateSerCate(serviceCategory);
	}
	// 删
	@Override
	public boolean deleteSerCate(int id) {
		return serCateDao.deleteSerCate(id);
	}
	// 查找一个
	@Override
	public List<ServiceCategory> findSerCate(String message) {
		return serCateDao.findSerCate(message);
	}

	// get,set方法
	public ISerCateDao getSerCateDao() {
		return serCateDao;
	}

	public void setSerCateDao(ISerCateDao serCateDao) {
		this.serCateDao = serCateDao;
	}

	
	
}
